package com.example.loginproject.models

import android.graphics.RectF

/**绘制的圆点的模型数据*/
data class DotModel(
    val num:Int,   //保存编号 记录密码
    val cx:Float,  //中心点xy -> 绘制点亮时的圆
    val cy:Float,
    val radius: Float, //半径
    var state: DotState = DotState.Normal //选中状态
){
    //判断是否包含一点
    fun containsPoint(x:Float,y:Float):Boolean{
        val rect = RectF(cx-radius,cy-radius,cx+radius,cy+radius)
        return rect.contains(x,y)
    }
}

enum class DotState{
    Normal ,Selected, Error
}